#ifndef PEERCONTAINER_H
#define PEERCONTAINER_H

#ifdef WIN32
#pragma warning(disable:4786)
#endif

#include <map>
#include <string>
#include "OSHeaders.h"
#include "SchTypeDef.h"
#include "OSMutex.h"

/**
* maintan the Peer and BC inforamtions
*/
class CPeer;
class CPeerContainer
{
protected:
	typedef std::map<PEERID, CPeer *>	_PeerMap;
	typedef _PeerMap::iterator		_PeerMapIterator;

public:
	CPeerContainer();
	
	~CPeerContainer();

public:
	Int32		AddPeer(CPeer * pPeer);
	Int32		DelPeer(PEERID vID);

	CPeer*		FindPeer(PEERID vID);
	Bool		FindPeer(CPeer *pPeer);

	CPeer*		AllocatePeer();
	void		ReclaimPeer(CPeer *pPeer);

	UInt32		GetPeerCount();

protected:
	OSMutex		m_Mutex;
	_PeerMap	m_PeersList;
};

#endif
